package fr.afcepf.atodcp2.benbai.dao.implementations;

import java.sql.ResultSet;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;

import fr.afcepf.atodcp2.benbai.dao.generique.GenericDaoHibernateTemplateImpl;
import fr.afcepf.atodcp2.benbai.dao.interfaces.IDaoAuthentification;
import fr.afcepf.atodcp2.benbai.entity.Authentification;

public class DaoAuthentification extends GenericDaoHibernateTemplateImpl<Authentification, Integer>
		implements IDaoAuthentification {

	
	
	@Override
	public Authentification getAuthentificationByLoginMdp(String login,
			String mdp) {
		String[] params = {"paramLogin", "paramMdp"};
		Object[] values = {login, mdp};
		@SuppressWarnings("unchecked")
		List<Authentification> result = hibernateTemplate.findByNamedParam("FROM Authentification a where a.login like :paramLogin AND a.pwd like :paramMdp", params, values);
		Authentification auth = result.get(0);		
		return auth;
	}

	
}
